package com.ThreadAlive;

public class ThreadInterruupt extends Thread{
    public void run(){
        try{
            sleep(50000);
        } catch (InterruptedException e) {
            System.out.println(e.getMessage());
        }
    }
    public static void main(String[] args) throws Exception{
        Thread thread = new ThreadInterruupt();
        thread.start();
        System.out.println("在50秒按任意键中断线程");
        System.in.read();
        thread.interrupt();
        thread.join();
        System.out.println("线程已退出");
    }

}
